package com.gec.model;

import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Daka {
	private String staffId;
	private String nickName;
	private String position;
	private String workingDate;
	private String shangbandakashijian;
	private String xiabandakashijian;
	private String sstatus;
	private String xstatus;
	// private String sopTime;
	// private String xopTime;

	public String getStaffId() {
		return staffId;
	}

	public void setStaffId(String staffId) {
		this.staffId = staffId;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getWorkingDate() {
		return workingDate;
	}

	public void setWorkingDate(String workingDate) {
		this.workingDate = workingDate;
	}

	public String getShangbandakashijian() {
		return shangbandakashijian;
	}

	public void setShangbandakashijian(String shangbandakashijian) {
		this.shangbandakashijian = shangbandakashijian;
	}

	public String getXiabandakashijian() {
		return xiabandakashijian;
	}

	public void setXiabandakashijian(String xiabandakashijian) {
		this.xiabandakashijian = xiabandakashijian;
	}

	public String getSstatus() {
		return sstatus;
	}

	public void setSstatus(String sstatus) {
		this.sstatus = sstatus;
	}

	public String getXstatus() {
		return xstatus;
	}

	public void setXstatus(String xstatus) {
		this.xstatus = xstatus;
	}

	@Override
	public String toString() {
		String f = String.format("|%4s|%8s|%9s|%7s|%10s|", this.workingDate, this.shangbandakashijian, this.sstatus, this.xiabandakashijian, this.xstatus);
		return f;
	}

	public Daka(ResultSet rs) throws SQLException {
		
		

		this.staffId = rs.getString("staffId");
		this.nickName = rs.getString("nickName");
		this.position = rs.getString("position");

		this.workingDate = rs.getString("wkd");
		
		if (rs.getString("shangbandakashijian").length() > 7) {
			this.shangbandakashijian = rs.getString("shangbandakashijian").split(" ")[1];
		} else if (rs.getString("xiabandakashijian").length() > 7) {
			this.xiabandakashijian = rs.getString("xiabandakashijian").split(" ")[1];
		} else {
			this.shangbandakashijian = rs.getString("shangbandakashijian");
			this.xiabandakashijian = rs.getString("xiabandakashijian");
		}
		this.sstatus = rs.getString("sstatus");
		this.xstatus = rs.getString("xstatus");
		// this.sopTime =rs1.getString(sopTime);
		// this.xopTime = rs2.getString(xopTime);
	}

}
